﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/Site.Master" AutoEventWireup="true" CodeBehind="Job.aspx.cs" Inherits="ERP.Page.Job" %>
<%@ MasterType VirtualPath="~/Page/Site.Master" %>
<%@ Register Src="~/PageUC/JobUC.ascx" TagPrefix="uc1" TagName="JobUC" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script>
        function setSelectedValue(selectObj, valueToSet) {
            for (var i = 0; i < selectObj.options.length; i++) {
                if (selectObj.options[i].text == valueToSet) {
                    selectObj.options[i].selected = true;
                    return;
                }
            }
        }
        function DetailRows(x) {
            //gets table
            var getTable = document.getElementById('MyTable');
            //gets cells of current row  
            var getCells = getTable.rows.item(x.rowIndex).cells;

            document.getElementById('<%=JobUC.lbID.ClientID %>').value = getCells.item(0).innerHTML;
            document.getElementById('<%=JobUC.txtChucVu.ClientID %>').disabled = true;
            document.getElementById('<%=JobUC.txtChucVu.ClientID %>').value = getCells.item(2).innerHTML;
            document.getElementById('<%=JobUC.txtGhiChu.ClientID %>').value = getCells.item(3).innerHTML;

            $("#chucvu").dialog("open");
        }
    </script>
    <script>
        function pageLoad() {
            //-------------------Tooltip-------------------
            Tooltip('.btn-add');
            Tooltip('.btn-delete');
            Tooltip('.btn-excel');
            Tooltip('.btn-search');
            Tooltip('.btn-reload');
            Tooltip('.btn-save');

            //--------------------Popup--------------------
            PopupUpdate('#chucvu');

            //--------------------DatePicker--------------------
            DatePicker('.textbox_child_text_ngay');

            //------------------TabletSort-----------------
            TableSort('#MyTable');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="upDateAll" runat="server">
        <ContentTemplate>
            <!---------------Toolbar---------------->
            <div class="toolbar-main">
                    <button id="btnAdd" class="btn btn-default btn-sm" title="Thêm mới" onclick="return Show('#chucvu');"><span class="glyphicon glyphicon-pencil"></span>Thêm mới</button>
                    <asp:LinkButton ID="btnDelete" CssClass="btn btn-default btn-sm" title="Xóa" runat="server" OnClientClick="return confirmCheckIn(this)" OnClick="btnDelete_Click"><span class="glyphicon glyphicon-trash"></span> Xoá</asp:LinkButton>
                    <asp:LinkButton ID="btnExcel" CssClass="btn btn-default btn-sm" title="Xuất file Excel" runat="server"><span class="glyphicon glyphicon-print"></span> Xuất file Excel</asp:LinkButton>
            </div>
            <!---------------Toolbar---------------->
            <%=StrAlert %>
            <!----------------Loading---------------->
            <asp:UpdateProgress ID="upDateProcess" runat="server" AssociatedUpdatePanelID="upDateAll">
                <ProgressTemplate>
                    <span style="text-align: center" class="label label-warning">Đang tải...</span>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <!--------------Kêt-thúc----------------->
            <!-------------Hiễn-Dữ-Liệu-------------->
            <div class="table-responsive">
                <asp:ListView ID="ListViewAll" runat="server" DataKeyNames="Job_Id">
                    <LayoutTemplate>
                        <table id="MyTable" class="tablesorter">
                            <thead>
                                <tr>
                                    <th style="text-align: center" data-sorter="false" data-filter="false">STT</th>
                                    <th style="text-align: center" data-sorter="false" data-filter="false">
                                        <input type="checkbox" onchange="checkAll()" id="chkAll" />
                                    </th>
                                    <th style="text-align: center" class="filter-select" data-placeholder="--Chọn chức vụ--">Chức vụ</th>
                                    <th style="text-align: center" data-sorter="false" data-filter="false">Ghi chú</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr id="itemPlaceholder" runat="server">
                                </tr>
                            </tbody>
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr runat="server" ondblclick="DetailRows(this)" class="warning">
                            <td style="text-align: center"><%# Eval("Job_Id") %></td>
                            <td style="text-align: center">
                                <asp:CheckBox ClientIDMode="Static" ID="chkList" runat="server" />
                            </td>
                            <td><%# Eval("Job_Name") %></td>
                            <td><%# Eval("Job_Note") %></td>
                        </tr>
                    </ItemTemplate>
                    <EmptyDataTemplate>
                        <div class='alert alert-danger'>
                            <a href='#' class='close' data-dismiss='alert'>&times;</a>
                            Không tìm thấy mẫu tin nào !
                        </div>
                    </EmptyDataTemplate>
                </asp:ListView>
            </div>
            <div class="pager">
                    <div class="toolbar-main">
                     <asp:LinkButton ID="btnReload" CssClass="btn btn-default btn-xs glyphicon glyphicon glyphicon-retweet" title="Tải lại" runat="server" OnClick="btnReload_Click"></asp:LinkButton>
                    &nbsp;
                    <asp:TextBox ID="txtSearch" CssClass="textbox-search" runat="server" />
                    <asp:LinkButton ID="btnSearch" CssClass="btn btn-default btn-xs glyphicon glyphicon glyphicon-search" title="Tìm kiếm" runat="server" OnClick="btnSearch_Click"></asp:LinkButton>
                    &nbsp;             
                    <span>Trang</span>
                        <select class="gotoPage" title="Select page number"></select>
                        <img src="../Content/TableSort/addons/pager/icons/first.png" class="first" alt="First" />
                        <img src="../Content/TableSort/addons/pager/icons/prev.png" class="prev" alt="Prev" />
                        <span class="pagedisplay"></span>
                        <img src="../Content/TableSort/addons/pager/icons/next.png" class="next" alt="Next" />
                        <img src="../Content/TableSort/addons/pager/icons/last.png" class="last" alt="Last" />
                    </div>
                </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnDelete" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnReload" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <!-------------Edit-Dữ-Liệu-------------->
    <div id="chucvu" title="Cập nhật chức vụ">
        <uc1:JobUC runat="server" ID="JobUC" />
    </div>
    <!--------------Kêt-thúc----------------->
</asp:Content>
